import { VisitService } from '@service/visit.service';
import { Component, Input, OnInit } from '@angular/core';

@Component({
	selector: 'app-visit-task-detail',
	templateUrl: './visit-task-detail.component.html',
	styleUrls: ['./visit-task-detail.component.less']
})
export class VisitTaskDetailComponent implements OnInit {
	@Input() id: string;
	@Input() formValue: any;

	data = [];
	nzLoading = false;
	page = {
		page: 1,
		limit: 30,
		total: 0
	}
	constructor(
		private visitService: VisitService
	) {
	}
	ngOnInit() {
		this.onSearch(true)
	}
	async onSearch(isPageInit?: boolean) {
		this.nzLoading = true;
		if (isPageInit) {
			this.page.page = 1;
		}
		const params = { ...this.formValue,id: this.id, ...this.page };
		const result = await this.visitService.getVisitByGrider(params);
		this.data = result.data.list;
		this.page.total = result.data.totalCount;
		this.nzLoading = false;
	}
	
}
